from selenium import webdriver
from selenium.webdriver.common.by import By
import time
from selenium.webdriver import ActionChains

browser = webdriver.Chrome()
# 隐示等待
browser.implicitly_wait(10)
browser.get('https://www.zhihu.com/explore')
input0 = browser.find_element_by_class_name('Button--blue')
print(input0)



# 执行JavaScript
# 下拉进度条
# browser.execute_script('window.scrollTo(0,document.body.scrollHeight)')
# browser.execute_script('alert("To Bottom")')#此方法将下拉到最底部，然后弹出alert提示框
# 获取属性
# logo = browser.find_element_by_id('special')#先选中这个节点
# print(logo)
# print(type(logo))
# print('+++++++++++')
# print(logo.get_attribute('class'))#来获取节点属性，先传入属性名，就可以得到属性值




# 获取文本
# input = browser.find_element_by_class_name('ExploreHomePage-specialsLoginButton')
# input1 = browser.find_element_by_class_name('Button--blue')
# print(input1.text)
# print(input.text)





# input1 = browser.find_element_by_class_name('zu-top-add-question')
# print(input1)
# # 获取id，位置，标签名，和大小
# print(input1.id)
# print(input1.location)
# print(input1.tag_name)
# print(input1.size)